import { Module } from '@nestjs/common';
import { APP_INTERCEPTOR } from '@nestjs/core';
import { AuditLogController } from './audit-log.controller';
import { AuditLogService } from './audit-log.service';
import { AuditLogInterceptor, RequestContextService } from '@nbase/nest-mods';

@Module({
  controllers: [AuditLogController],
  providers: [
    AuditLogService,
    {
      provide: APP_INTERCEPTOR,
      useFactory: (auditLogService: AuditLogService, requestContext: RequestContextService) => {
        return new AuditLogInterceptor(auditLogService, requestContext);
      },
      inject: [AuditLogService, RequestContextService],
    },
  ],
  exports: [AuditLogService],
})
export class AuditLogModule {}

